<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>出款查询</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type="text/javascript">
	
	//查询结算信息
		function queryCheck(){
		var pathStr = "<%=basePath%>topayAgain/queryToPayAgainMoneyJsp.ct";
				$("#querytoPayForm").attr("action",pathStr);
				$("#querytoPayForm").submit();
				$("#queryBtnId").attr("disabled","true");
				 
		}
	//导出excel	
		function exportCheck(){
				$("#querytoPayForm").attr("action","<%=basePath%>/topayAgain/exportInit.ct");
				$("#querytoPayForm").submit();
				$("#szPower").attr("disabled","true");
		}
	
	 function openReason(remark){ 
         var ScreenWidth = screen.availWidth ;
         var ScreenHeight = screen.availHeight; 
         var StartX = (ScreenWidth - innerWidth) / 2 ;
         var StartY = (ScreenHeight - innerHeight) / 2 ;
    	 var url =  "<%=basePath%>/topayAgain/queryToPayAgainFailInfoJsp.ct?remark="+remark;
    	 window.open(url, '补付详情', 'left='+ StartX + ', top='+ StartY + ', Width=' + innerWidth +', height=' + innerHeight + ', resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, location=no'); 
     } 
	
	function payAgain(){
		var dd = $("input[name=multi_sel]:checked");
		if(dd.length != 1){
			alert("请选择一条记录");
			return false;
		}
		var idd = dd.val();							
		if(dd.length == 0){
			alert("请选择记录");
			return false;
		}else{
			$.ajax({
				url:"<%=basePath%>/topayAgain/updatePayStatus.ct",
				type:"post",
				data:{"againId":idd},
				dataType:"json",
				success:function(result){
					var flag = result.flag;
					if(flag){
						alert("补付申请提交成功");
						location.reload();
					}else{
						alert("补付申请提交失败");
						
					}
				},error:function(){
					alert("未知错误！");
				}
			});
		}
	}
	</script>
</head>
<body>
<s:form id="querytoPayForm" action="/topayAgain/queryToPayAgainMoneyJsp.ct" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">出款查询</div></td>
        </tr>
		<tr class="tb-line">
            
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                <s:textfield name="searchCondition.mchtCd" cssClass="queryWidth"></s:textfield>
                </label>
            </td>
            
            <td align="right" class="tb-td">
                <div class="tb-h4">商户名：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                <s:textfield name="searchCondition.mchtName" cssClass="queryWidth"></s:textfield>
                </label>
            </td>
        </tr>		
        <tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">银行账号：</div>
            </td>
            <td class="tb-td">
 				<label class="tb-input-normal">
 				 <s:textfield name="searchCondition.accountNo" cssClass="queryWidth"></s:textfield>
 				</label></td>
			<td align="right" class="tb-td">
                <div class="tb-h4">结算日期：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini">
                <s:textfield id="settleDateMin" name="searchCondition.applyDateMin" placeholder="起始日期" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" cssClass="queryWidth"></s:textfield>
                </label>-
                <label class="tb-input-mini">
                <s:textfield id="settleDateMax" name="searchCondition.applyDateMax" placeholder="结束日期" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" cssClass="queryWidth"></s:textfield>
                </label>
            </td>
            
        </tr>
         <tr class="tb-line">
 
			<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">机构：</div>
            </td>
            <td class="tb-td">
 				<label class="tb-select">
				 <s:select name="searchCondition.org" list="#{'48502000':'新POSP'}" headerKey="" headerValue="不限" cssClass="queryWidth" id="orgCode"/> 
                </label>
             </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">交易日期：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini">
                <s:textfield id="setDateMin" name="searchCondition.setDateMin" placeholder="起始日期" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" cssClass="queryWidth"></s:textfield>
                </label>-
                 <label class="tb-input-mini">
                <s:textfield id="setDateMax" name="searchCondition.setDateMax" placeholder="结束日期" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" cssClass="queryWidth"></s:textfield>
                </label>
            </td>          
        </tr>
         <tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
             <input type="hidden" name="searchCondition.status" value="6"/>
                <div class="tb-h4">流水号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                <s:textfield id="setDate" name="searchCondition.merchantsn"  cssClass="queryWidth"></s:textfield>
                </label>
            </td> 
            <td align="right" class="tb-td">
                <div class="tb-h4">结算ID：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini">
                <s:textfield id="setDate" name="searchCondition.id"  cssClass="queryWidth"></s:textfield>
                </label>
            </td>          
        </tr>
		<tr>
						<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
		</tr>
        
        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input id="queryBtnId" type="button" value="查询" onclick="queryCheck()"/>
                </label>
                <label class="tb-input-submit">
                    <input type="reset" value="取消"/>
                </label>
                
                <label class="tb-input-submit">
                	<s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
					   		<input type="button" value="补付" onclick="payAgain()"/>				   
					</s:if>
					<s:else>
					 	<input disabled="disabled" value="补付" type="button" /> 
					</s:else>
                </label>
            </td>
        </tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/topayAgain/queryToPayAgainMoneyJsp.ct?currentPage=" />

				</td>
			</tr>
		</s:if>
    </tbody>
</table>

<div class="big-tb">
    <table class="tb" style="width: 160%;">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="16">出款信息列表</th>
            </tr>
            <tr class="tb-line bg-gray">
                <th class="tb-th" style="min-width:20px"></th>
            	<th class="tb-th">结算ID</th>            	           	           	
                <th class="tb-th">商户号</th>
                <th class="tb-th">商户名称</th>
                <th class="tb-th">出款状态</th>
                <th class="tb-th">商户变更标志</th>
                <th class="tb-th">补付次数</th>
                <th class="tb-th">出款金额（元）</th>
                <th class="tb-th">商户手续费（元）</th>
                <th class="tb-th">冻结金额（元）</th>  
                <th class="tb-th">结算金额（元）</th>
                <th class="tb-th">交易金额（元）</th>				
                <th class="tb-th">账号名称</th>
                <th class="tb-th">结算银行</th>
                <th class="tb-th">结算银行账号</th>                
                <th class="tb-th">流水号</th>
                <th class="tb-th">结算日期</th>
                <th class="tb-th">交易日期</th>  
            </tr>
        </thead>
        <tbody>
			<s:iterator value="#request.settleList" status="stat" id="bean">
				<tr  class="tb-line">
					<td class="tb-td" align="center">
						<input name="multi_sel" value="<s:property value="#bean.remark1"/>" type="checkbox" />
					</td>
					<td class="tb-td">
						<s:property value="#bean.id"/>
					</td>															
					<td class="tb-td">
						<s:property value="#bean.mchtCd"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.mchtName"/>
					</td>
					<td class="tb-td"  align="center">
						<s:property value="#bean.settleFlag"/>
					</td>
					<td class="tb-td"  align="center">
						<s:property value="#bean.changeFlag"/>
					</td>
					<td class="tb-td"  align="center">
						<s:if test="#bean.count==0">
						<s:property value="#bean.count" />
						</s:if>
						<s:else>
						<a href="javascript:void(0)" onclick="openReason('<s:property value="#bean.remark1"/>')"><s:property value="#bean.count" /></a>
						</s:else>
					</td>
					<td class="tb-td">
						<s:property value="#bean.unFreezeAmt"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.mchtFee"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.freezeAmt"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.mchtSetAmt"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.transAmt"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.accountName"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.bankName"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.account"/>
					</td>					
					<td class="tb-td">
						<s:property value="#bean.serialNo"/>
					</td>					
					<td class="tb-td">
						<s:property value="#bean.settleDate"/>
					</td>
					<td class="tb-td">
						<s:property value="#bean.setDate"/>
					</td>
				</tr>
			</s:iterator>
        </tbody>
    </table>
</div>
</s:form>
</body>
</html>